home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Headers / MUI / gizmo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  7.4 KB  |  242 lines  |  [TEXT/CWIE]

  1. /*
  2.  * Copyright (c) 1993-1997, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
  36.  */
  37.  
  38.  /* jot text editor source code. */
  39.  /*        Tom Davis         */
  40.  /*     February 7, 1992     */
  41.  
  42. /* defines for gizmos */
  43.  
  44. #include "mui.h"
  45.  
  46. #define BUTSTRLEN    60
  47. #define LABELSTRLEN    150
  48.  
  49. #define FONTWIDTH    9    /* for fixed font */
  50. #define BASELINE    9
  51.  
  52. /* BUTTON STUFF */
  53. #define PUSHBUTTON    3
  54. #define RADIOBUTTON    6
  55. #define INDICATOR    9
  56. #define BED        10
  57. #define BUTTON        11
  58.  
  59. #define BUTHEIGHT    28
  60. #define BUTWIDTH    75
  61. #define RADIOWIDTH    24
  62. #define RADIOHEIGHT    24
  63. #define TINYRADIOHEIGHT 16
  64. #define TINYRADIOWIDTH  16
  65.  
  66. typedef struct butn {
  67.     char str[BUTSTRLEN+1];
  68.     int type;
  69.     void (*butcolor)();
  70.     struct butn *link;        /* for linking radio buttons, e.g. */
  71.     muiObject *object;
  72. } muiButton;
  73.  
  74.  
  75. /* TEXT BOX STUFF */
  76. #define TBSTRLEN     200 
  77. #define TEXTHEIGHT    17
  78. #define TEXTBOXHEIGHT   28
  79.  
  80. typedef struct {
  81.     char    str[TBSTRLEN+1];
  82.     char    label[LABELSTRLEN+1];
  83.     int    tp1, tp2;
  84.     int    charWidth;
  85.     int    type;
  86. } muiTextBox;
  87.  
  88. muiTextBox *newtb(int xmin, int xmax);
  89.  
  90. /* LABEL STUFF */
  91.  
  92. #define LBLSTRLEN   200        /* max length of a label string */
  93.  
  94. typedef struct {
  95.     char    str[LBLSTRLEN+1];
  96. } Label;
  97.  
  98. Label *newlabel(char *s);
  99.  
  100. /* SLIDER STUFF */
  101.  
  102. #define SLIDERWIDTH    20
  103. #define MINSHALF    13
  104. #define ARROWHEIGHT    20
  105.  
  106. #define SCROLLDOWN    -1
  107. #define SCROLLUP    1
  108. #define THUMB        2
  109.  
  110. typedef struct {
  111.     int        scenter;                /* the center of the thumb */
  112.     int        shalf;                  /* half of the thumb length */
  113.     int        oldpos;                 /* old scenter  */
  114.     int        arrowdelta;             /* arrow delta  */
  115.     int        thumb;                  /* whether the thumb should show */
  116. } Slider;
  117.  
  118. typedef Slider VSlider;
  119. typedef Slider HSlider;
  120.  
  121. /* TEXTLIST STUFF */
  122.  
  123. typedef struct {
  124.     int        listheight;         /* in lines of text */
  125.     char        **strs;            /* text    */
  126.     int        top;            /* index into strs */
  127.     int        count;          /* total number of strings */
  128.     int        selecteditem;        /* index into selecteditem or -1 */
  129.     int        locateditem;        /* index into locateditem or -1 */
  130. } muiTextList;
  131.  
  132. /* PULLDOWN STUFF */
  133.  
  134. #define PULLDOWN_HEIGHT 25
  135.  
  136. typedef struct {
  137.     char    title[40];
  138.     int        menu;
  139.     int        xoffset;
  140. } menuentry;
  141.  
  142. typedef struct {
  143.     int        count;
  144.     int        ishelp;
  145.     menuentry    menus[30];
  146.     menuentry    helpmenu;
  147. } muiPulldown;
  148.  
  149.  
  150. /* Define for the settbtype() and gettypein() flag */
  151. #define TYPEIN_STRING    0
  152. #define TYPEIN_INT    1
  153. #define TYPEIN_FILE    2
  154. #define TYPEIN_FLOAT    3
  155.  
  156. /* Color Stuff */
  157.  
  158. extern muiButton    *newbed(void);
  159. extern muiButton    *newbut(void);
  160. extern muiButton    *newradiobut(void);
  161. extern muiPulldown    *newpd(void);
  162. extern void    drawbut(muiObject *);
  163. extern void    drawvs(muiObject *obj);
  164. extern void    drawhs(muiObject *obj);
  165. extern void    drawtl(muiObject *obj);
  166. extern void    drawradiobutton(muiObject *obj);
  167. extern void    drawtinyradio(muiObject *obj);
  168. extern void    drawpulldown(muiObject *obj);
  169. extern int    getcurrentcolor(void);
  170. extern void    setcurrentcolor(int c);
  171. extern void    drawedges(int, int, int, int, void (*)(void), void (*)(void));
  172. extern void    loadbut(muiButton *,  char *);
  173. extern void    drawbut(muiObject *);
  174. extern int    pressbut(muiObject *);
  175. extern void    drawlabel(muiObject *);
  176. extern void    drawboldlabel(muiObject *);
  177. extern void    loadtb(muiTextBox *, char *);
  178. extern int    handletb(muiObject *, int, int);
  179. extern void    drawtb(muiObject *);
  180. extern int    inbut(muiButton *, int, int);
  181. extern int    intb(muiObject *, int, int);
  182. extern void    activatetb(muiTextBox *);
  183. extern void    deactivatetb(muiTextBox *);
  184. extern char    *gettbstr(muiTextBox *);
  185.  
  186. extern VSlider    *newvs(muiObject *obj, int ymin, int ymax, int scenter, int shalf);
  187. extern VSlider    *newhs(muiObject *obj, int xmin, int xmax, int scenter, int shalf);
  188. extern void    drawsetup(void);
  189. extern void    drawrestore(void);
  190. extern void    backgrounddraw(int xmin, int ymin, int xmax, int ymax);
  191. extern muiTextList *newtl(muiObject *obj, int listheight);
  192.  
  193. extern enum muiReturnValue  buttonhandler(muiObject *obj, int  event, int  value, int  x, int  y);
  194. extern enum muiReturnValue  nullhandler(muiObject *obj, int  event, int  value, int  x, int  y);
  195. extern enum muiReturnValue  textboxhandler(muiObject *obj, int  event, int  value, int  x, int  y);
  196. extern enum muiReturnValue  vshandler(muiObject *obj, int event, int value, int x, int y);
  197. extern enum muiReturnValue  hshandler(muiObject *obj, int event, int value, int x, int y);
  198. extern enum muiReturnValue  tlhandler(muiObject *obj, int event, int value, int x, int y);
  199. extern enum muiReturnValue  pdhandler(muiObject *obj, int event, int value, int x, int y);
  200.  
  201.  
  202. /* mui events */
  203.  
  204. #define MUI_DEVICE_DOWN            1
  205. #define MUI_DEVICE_UP            2
  206. #define MUI_DEVICE_PRESS        3
  207. #define MUI_DEVICE_RELEASE        4
  208. #define MUI_DEVICE_CLICK        5
  209. #define MUI_DEVICE_DOUBLE_CLICK        6
  210. #define MUI_KEYSTROKE            7
  211.  
  212. #define MUI_BUTTONFONT            0
  213. #define MUI_BUTTONFONT_BOLD        0
  214.  
  215. typedef struct muicons {
  216.     struct muicons  *next;
  217.     muiObject        *object;
  218. } muiCons;
  219.  
  220. void        muiBackgroundClear(void);
  221.  
  222. void        muiFreeObject(muiObject *obj);
  223. int        muiInObject(muiObject *obj, int x, int y);
  224.  
  225. int        muiGetLocate(muiObject *obj);
  226. void        muiSetLocate(muiObject *obj, int state);
  227. int        muiGetSelect(muiObject *obj);
  228. void        muiSetSelect(muiObject *obj, int state);
  229. muiCons        *muiGetListCons(int uilist);
  230. muiObject   *muiGetActiveTB(void);
  231. void        muiSetUIList(muiObject *obj, int list);
  232. int        muiGetUIList(muiObject *obj);
  233.  
  234. void        muiDrawObject(muiObject *obj);
  235.  
  236. void        muiError(char *s);
  237.  
  238. muiObject   *muiHitInList(int  uilist, int  x, int  y);
  239. void        muiDrawUIList(int  uilist);
  240. void        muiHandleEvent(int  event, int  value, int  x, int  y);
  241.  
  242.